<form class="layui-form" lay-filter="form" id="form" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">商品金额￥</label>
        <div class="layui-input-inline">
            <input type="text" name="sell_price_total" class="layui-input" readonly>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">优惠金额￥</label>
        <div class="layui-input-inline">
            <input type="text" name="promotion_price" class="layui-input" value="" readonly>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">改价金额￥</label>
        <div class="layui-input-inline">
            <input type="text" name="discount_price" lay-verify="price" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">运费金额￥</label>
        <div class="layui-input-inline">
            <input type="text" name="delivery_price_real" lay-verify="price" autocomplete="off" class="layui-input">
            <div class="layui-form-mid layui-word-aux">默认金额0表示不包邮</div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">支付金额￥</label>
        <div class="layui-input-inline">
            <input type="text" name="subtotal" class="layui-input" readonly>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-block">
            支付金额=商品金额-优惠金额+改价金额+运费金额
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <input type="hidden" name="id" value="">
            <input type="button" lay-submit lay-filter="form-submit" value="确认" class="layui-btn">
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
    layui.use(['form'], function () {
        var form = layui.form;

        //自定义验证规则
        form.verify({
            price: [
                /(^-|[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
                '请输入正确的金额,且最多两位小数!'
            ]
        });
    });
</script>